Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

getData: add fread support, refactor code, expand roxygen #27

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

ck37
Copy link

@ck37 ck37 commented Sep 24, 2021

Hello,

Here is a PR to refactor the functions in getData.R and getData_nodocker.R. My primary motivation was to support data.table's fread() csv import function to speed up CSV imports for large files. While I was doing that I tried to refactor the code to remove duplication and add roxygen for the man pages. Happy to modify if any changes are preferred.

Here is some testing code that I tried on BIDMC data (7.2 million rows):

# Takes 27 seconds with read.csv
system.time({
LocalPatientObservations = FourCePhase2.1Data::getLocalPatientObservations()
})

# 5-6 seconds with fread
system.time({
LocalPatientObservations = FourCePhase2.1Data::getLocalPatientObservations(fread = TRUE)
})

# Change to fread by default.
options(`4ce.fread` = TRUE)
# Confirm that it worked:
getOption("4ce.fread")

# Now uses fread without specifying in function call.
system.time({
LocalPatientObservations = FourCePhase2.1Data::getLocalPatientObservations()
})

Cheers,
Chris

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant